#!/bin/sh

ffuser()
{
	echo "$fcname:::::::/home/$fcname:/bin/sh:$fcpwd" | adduser -f - -w yes
}

ffportsnap()
{
	ffbak /etc/portsnap.conf
	echo "SERVERNAME=$fcportsnap" >> /etc/portsnap.conf
	#portsnap fetch extract || portsnap fetch extract || portsnap fetch extract
  mkdir -p /usr/ports
}

ffspeed()
{
	cp $fcconf/make.conf /etc/
	echo "MAKE_JOBS_NUMBER=$fccpu" >> /etc/make.conf
	echo 'autoboot_delay="1"' >> /boot/defaults/loader.conf
  echo  "192.168.1.4:/usr/ports /usr/ports nfs ro 0 0" >> /etc/fstab
	echo 'tmpfs	/tmp	tmpfs	rw	0	0' >> /etc/fstab
  echo 'rpcbind_enable="YES"' >> /etc/rc.conf
  echo 'nfs_client_enable="YES"' >> /etc/rc.conf
  echo 'amd_enable="YES"' >>  /etc/rc.conf
}

ffmotd()
{
	cp $fcconf/motd /etc/
}

fftime()
{
  service ntpd stop
  ntpdate 192.168.1.4 || ntpdate ntp.sjtu.edu.cn
}

ffhostname()
{
  ffstr 'hostname=\"fast\"' hostname=\"$fcid\" /etc/rc.conf 
}


ffopt()
{
	ffuser && ffportsnap && ffspeed && ffmotd && fftime && ffhostname
}

ffgnomeopt()
{
	cp $fcconf/make.gnome.conf /etc/make.conf
	ffuser && ffspeed && ffmotd
}
